﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WuDada.Core.Member.Domain;

namespace WuDada.Core.Member.Persistence
{
    public interface IMemberDao
    {
        /// <summary>
        /// 新增Member
        /// </summary>
        /// <param name="memberVO">被新增的Member</param>
        /// <returns>新增後的Member</returns>
        MemberVO CreateMember(MemberVO memberVO);

        /// <summary>
        /// 取得Member By MemberId
        /// </summary>
        /// <param name="memberId">MemberId</param>
        /// <returns>Member</returns>
        MemberVO GetMemberById(int memberId);

        /// <summary>
        /// 取得Member By LoginId
        /// </summary>
        /// <param name="loginId">LoginId</param>
        /// <returns>Member</returns>
        MemberVO GetMemberByLoginId(string loginId);

        /// <summary>
        /// 刪除Member
        /// </summary>
        /// <param name="memberVO">被刪除的Member</param>
        void DeleteMember(MemberVO memberVO);

        /// <summary>
        /// 更新Member
        /// </summary>
        /// <param name="memberVO">被更新的Member</param>
        /// <returns>更新後的Member</returns>
        MemberVO UpdateMember(MemberVO memberVO);

        /// <summary>
        /// 取得Member
        /// </summary>     
        /// <param name="sortField">排序欄位</param>
        /// <param name="sortDesc">升降冪排序</param>
        /// <returns>Member清單</returns>
        IList<MemberVO> GetMemberList(string sortField, bool sortDesc);

        /// <summary>
        /// 取得Member
        /// </summary>
        /// <param name="pageIndex">分頁索引</param>
        /// <param name="pageSize">分頁大小</param>
        /// <param name="sortField">排序欄位</param>
        /// <param name="sortDesc">升降冪排序</param>
        /// <returns>Member清單</returns>
        IList<MemberVO> GetMemberList(int pageIndex, int pageSize, string sortField, bool sortDesc);

        /// <summary>
        /// 取得Member筆數
        /// </summary>
        /// <returns>Member清單</returns>
        int CountMemberListByPostId();

        /// <summary>
        /// 動態查詢筆數Member
        /// </summary>
        /// <param name="where">搜尋語法，用Where...order by ...</param>
        /// <returns>筆數</returns>
        int CountMemberByWhere(string where);

        /// <summary>
        /// 動態查詢Member
        /// </summary>
        /// <param name="where">搜尋語法，用Where...order by ...</param>
        /// <param name="pageIndex">分頁索引</param>
        /// <param name="pageSize">分頁大小</param>
        /// <returns>搜尋結果</returns>
        IList<MemberVO> SearchMemberByWhere(string where, int pageIndex, int pageSize);
    }
}
